package com.broadengate.util;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.broadengate.bean.DepartmentInfo;
import com.broadengate.init.IsmpInit;
import com.broadengate.service.UserService;

public class WebToolsUtil
{
    
    @Autowired
    private UserService userService;
    
    /**
     * 根据部门ID获取部门信息
     * @param departmentId
     * @return [参数说明]
     * 
     * @return String [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    public static String getDepartmentNameById(int departmentId)
    {
        
        //获取系统初始化部门列表
        List<DepartmentInfo> departmentInfoList = IsmpInit.getDepartmentInfo();
        DepartmentInfo tmp = new DepartmentInfo();
        if (departmentInfoList != null && departmentInfoList.size() > 0)
        {
            for (DepartmentInfo departmentInfo : departmentInfoList)
            {
                tmp = departmentInfo.getDepartmentInfoById(departmentInfo, departmentId);
            }
        }
        
        if (tmp != null)
        {
            return tmp.getDepartmentName();
        }
        else
        {
            
            return "";
        }
        
    }
    
}
